package com.consumer.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @Author：Administrator
 * @Date：2022/7/25/0025 23:41
 * @Versiion：1.0
 */
@RestController
@Slf4j
public class ConsumerController {

    @Value("${service-url.nacos-user-service}")
    private String serverUrl;

    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/pay")
    public String get(){
        log.info("request uri:{}",serverUrl);
        String forObject = restTemplate.getForObject(serverUrl + "/getPayment", String.class);
        return forObject;
    }
}
